/*
题目链接: https://leetcode.cn/problems/check-balanced-string/description/?envType=daily-question&envId=2025-03-14
*/

//题解代码:
class Solution {
public:
    bool isBalanced(string num) {
        int odd = 0, even = 0;
        int n = num.size();
        for(int i=0;i<n;++i){
            if(i&1){
                odd += (num[i]-'0');
            }else{
                even += (num[i]-'0');
            }
        }
        return odd == even;
    }
};
